package cn.com.nwpu.visual_system.controller;

import cn.com.nwpu.visual_system.service.ReactorService;
import cn.com.nwpu.visual_system.utils.Response;
import cn.com.nwpu.visual_system.vo.ReactorDetailVo;
import cn.com.nwpu.visual_system.vo.ReactorVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Hutengzhong
 * @version 1.0.0
 * @title ReactorController
 * @description TODO 与反应器相关的控制请求
 * @date 2024/4/27 16:29
 */
@RestController
@RequestMapping("reactor")
public class ReactorController {

    @Autowired
    ReactorService reactorService;

    /**
     * 获取所有反应器类型（包括输出和输入）
     * @return
     */
    @PostMapping("reactorList")
    public Response getReactorList(){
        List<ReactorVo> reactorVoList = reactorService.getReactorList();
        Response response = new Response(200, "反应器列表", true);
        response.setData(reactorVoList);
        return response;
    }

    @GetMapping("reactorSensor")
    public Response getReactorSensorDetailList(@RequestParam("id") Integer id){
        List<ReactorDetailVo> reactorDetailVoList = reactorService.getReactorSensorDetailList(id);
        Response response = new Response(200, "跟当前反应器相关的传感器", true);
        response.setData(reactorDetailVoList);
        return response;
    }
}
